import App from './App'
import {
  $http
} from "@escook/request-miniprogram"
// 导入vuex
import store from "./store/index.js"
uni.$http = $http
$http.baseUrl = 'https://api-hmugo-web.itheima.net'
// 请求开始之前做一些事情
$http.beforeRequest = () => {
  uni.showLoading({
    title: '数据加载中...',
  })
}
// 请求完成之后做一些事情
$http.afterRequest = () => {
  uni.hideLoading()
}
// 分封接口错误提示方法
uni.$showMsg = (title = "数据加载中...", duration = 2000) => {
  uni.showToast({
    title,
    duration,
    icon: 'error'
  })
}
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
// 挂载vuex
const app = new Vue({
  ...App,
  store
})
app.$mount()
// #endif

// #ifdef VUE3
import {
  createSSRApp
} from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif
